package com.ruoyi.game.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.game.mapper.GoldCoinRecordMapper;
import com.ruoyi.game.domain.GoldCoinRecord;
import com.ruoyi.game.service.IGoldCoinRecordService;

/**
 * 金币记录Service业务层处理
 *
 * @author 小胖
 * @date 2022-05-11
 */
@Service
public class GoldCoinRecordServiceImpl implements IGoldCoinRecordService
{
    @Autowired
    private GoldCoinRecordMapper goldCoinRecordMapper;

    /**
     * 查询金币记录
     *
     * @param goldCoinId 金币记录主键
     * @return 金币记录
     */
    @Override
    public GoldCoinRecord selectGoldCoinRecordByGoldCoinId(Long goldCoinId)
    {
        return goldCoinRecordMapper.selectGoldCoinRecordByGoldCoinId(goldCoinId);
    }

    /**
     * 查询金币记录列表
     *
     * @param goldCoinRecord 金币记录
     * @return 金币记录
     */
    @Override
    public List<GoldCoinRecord> selectGoldCoinRecordList(GoldCoinRecord goldCoinRecord)
    {
        return goldCoinRecordMapper.selectGoldCoinRecordList(goldCoinRecord);
    }

    /**
     * 新增金币记录
     *
     * @param goldCoinRecord 金币记录
     * @return 结果
     */
    @Override
    public int insertGoldCoinRecord(GoldCoinRecord goldCoinRecord)
    {
        goldCoinRecord.setCreateTime(DateUtils.getNowDate());
        goldCoinRecord.setCreateBy(SecurityUtils.getUsername());
        return goldCoinRecordMapper.insertGoldCoinRecord(goldCoinRecord);
    }

    /**
     * 修改金币记录
     *
     * @param goldCoinRecord 金币记录
     * @return 结果
     */
    @Override
    public int updateGoldCoinRecord(GoldCoinRecord goldCoinRecord)
    {
        goldCoinRecord.setUpdateTime(DateUtils.getNowDate());
        goldCoinRecord.setUpdateBy(SecurityUtils.getUsername());
        return goldCoinRecordMapper.updateGoldCoinRecord(goldCoinRecord);
    }

    /**
     * 批量删除金币记录
     *
     * @param goldCoinIds 需要删除的金币记录主键
     * @return 结果
     */
    @Override
    public int deleteGoldCoinRecordByGoldCoinIds(Long[] goldCoinIds)
    {
        return goldCoinRecordMapper.deleteGoldCoinRecordByGoldCoinIds(goldCoinIds);
    }

    /**
     * 删除金币记录信息
     *
     * @param goldCoinId 金币记录主键
     * @return 结果
     */
    @Override
    public int deleteGoldCoinRecordByGoldCoinId(Long goldCoinId)
    {
        return goldCoinRecordMapper.deleteGoldCoinRecordByGoldCoinId(goldCoinId);
    }
}
